<?php
// +----------------------------------------------------------------------
// | 云游线路产品开发
// +----------------------------------------------------------------------
// | Author: TongBC <50249101@qq.com>
// +----------------------------------------------------------------------
// | Date  : 2015/02/03
// +----------------------------------------------------------------------
// | table : pft_scenic
// +----------------------------------------------------------------------
use \pft\Prod\Product;
include '/var/www/html/new/d/common/header.html';
include '/var/www/html/new/d/common/left.html';
include '/var/www/html/new/d/common/autoload.php';
include '/var/www/html/new/d/common/prodField.php';

$ptype = strtoupper($_GET['type']);
$saveBtn = '<button class="ui-button ui-button-lblue" id="saveProduct" data-wrap="ticketBox" type="button">保存，返回列表</button>';

$apply_did = $_SESSION['sid'];// 供应商ID

// 身份认证
if($_SESSION['dtype']==6 && $_SESSION['sdtype']!=0) {
    exit('您的上级不是供应商身份，无法发布产品。');
}elseif($_SESSION['dtype']!=0 && $_SESSION['dtype']!=9) {
    exit('您不是供应商身份，无法发布产品。');
}

// 获取子景点信息
$cid = $_REQUEST['id'] + 0;
if($cid>0){
	$scenic = array();
	$sql="select * from pft_scenic where id=$cid limit 1";
	$GLOBALS['le']->query($sql);
	$scenic = $GLOBALS['le']->fetch_assoc();
}
// print_r($scenic);

$thumb = $scenic['thumb_path'] ? $scenic['thumb_path']:'prodimgs/123642/20140916/14108485792643.jpg';
$video = $scenic['video_path'] ? $scenic['video_path']:'';
$voice = $scenic['intro_voice_path'] ? $scenic['intro_voice_path']:'';
$panorama = $scenic['degree_path'] ? $scenic['degree_path']:'';


// 父景点ID 即 uu_land 表 id
$parent_id = $_REQUEST['lid'] ? $_REQUEST['lid']:$scenic['lid'];
// if(empty($parent_id)) exit('非法访问');

$page_title = "产品发布 - ";
?>
<link rel="stylesheet" href="http://www.12301.cc/css/aliceui.min.css"/>
<link rel="stylesheet" href="http://www.12301.cc/css/resetui.css"/>
<link rel="stylesheet" href="http://www.12301.cc/css/prod_store.css"/>
<script src="http://www.12301.cc/js/WdatePicker.js"></script>
<div class="wrapper">
<h3 class="mc_title">
	<span class="mctit_1"><span class="mctit_2">营销活动发布</span></span>
</h3>
<?if(!$isedit||isset($_GET['step'])){?>

<?}?>

	
<div id="sceneryBox" class="ui-box mt10 fn-clear">
<?if($isedit){?>
<div class="ui-box-head">
	<h3 class="ui-box-head-title"><?=$ProdTypes[$ptype]?>信息</h3>
	<span class="ui-box-head-text"></span>
	<a href="#" class="ui-box-head-more"></a>
</div>
<?}?>
<div class="ui-box-container">
	<div class="ui-box-content">
	<form name="mainForm" id="mainForm" class="ui-form" method="post" action="../../call/upload_discount.php" enctype="multipart/form-data" target="hideFrame">
	<input type="hidden" name="lastid" value="<?=$scenic['id']?>"/>
	<input type="hidden" name="parent_id" value="<?=$parent_id?>"/>
	<input type="hidden" name="applydid" value="<?=$apply_did?>"/>
	<input type="hidden" name="action" value="scenic"/>
	<input type="hidden" name="nf" value="<?=$_REQUEST['nf']?>"/>
	<input type="hidden" name="upload_mth" id="upload_mth" value="1"/> 
	<fieldset>
		<div class="ui-form-item">
			<label class="ui-label"><span class="ui-form-required">*</span>活动名称</label>
			<input title="请填写<?=$FieldList[$ptype]['title']?>" class="ui-input check w408" data-required="2" id="mainTitle" name="mainTitle" type="text" autofocus value="<?=($_REQUEST['title']) ? $_REQUEST['title']:$scenic['scenic_name']?>" />
			<span class="ui-form-other ui-form-explain">请填写活动名称</span>
		</div>
		<div class="ui-form-item">
			<label class="ui-label"><span class="ui-form-required">*</span>活动时间</label>
			<input type="text" data-t="bt" class="ui-input" id="txtStartTime" data-msg="请选择时间段" value="<?=substr($data['order_start'],0,10)?>"  name="order_start" class="required input-text w66"  /> 至
			<input type="text" data-t="bt" class="ui-input" id="txtEndTime" data-msg="请选择时间段" value="<?=substr($data['order_end'],0,10)?>"  name="order_end" class="required input-text w66"  />	
		</div>
		<div class="ui-form-item">
			<label class="ui-label">
				<span class="ui-form-required">*</span>分享网页
			</label>
			<textarea class="ui-textarea_msg" name="show_html"></textarea>
		</div>
		<div class="land ui-form-item">
			<label class="ui-label"><span class="ui-form-required">*</span>活动类型</label>
			<select name="discount_type" size="1" onChange="change()" id="goods_style"> 
				<option value="0" selected="selected">秒杀</option> 
				<option value="1">限量打折</option> 
				<option value="2">分享立减</option> 
			</select>
		</div>
		<div class="land ui-form-item">
			<label class="ui-label"><span class="ui-form-required">*</span>优惠内容</label>
			<span id="dropmsg">减现金&nbsp;<input name="down_money" class="ui-input_msg">&nbsp;元</span>
			<span id="dropmsg_a">总金额打&nbsp;<input name="discount_money" class="ui-input_msg" >&nbsp;折</span>
			<span class="ui-form-other ui-form-explain" ></span>
		</div>	
		<div class="ui-form-item" style="position: relative;">
			<label class="ui-label"><span class="ui-form-required">*</span>图片</label>
			<a class="lnk_prv" target="_blank" title="点击查看原图" href="http://www.12301.cc/<?=$thumb?>">
				<input type="hidden" name="thumb_img" class="thumb_img" value="<?=$thumb?>"/>
				<img style="width:240px;height:160px;" src="http://www.12301.cc/<?=$thumb?>" class="preview" />
			</a>
			<div class="uploadImg">
				<p class="title">重新上传缩略图：</p>
				<input type="file" name="upfile" id="imgup"/>
				<input type="button" id="BtnUpload" value="上传" class="ui-button ui-button-swhite"/>
				<p class="ui-form-explain">点击上传小于1M的JPG或GIF格式的图片,<br/>建议图片尺寸：宽350像素，高230像素</p>
				<p class="waitingUpload" class="ui-form-other"></p>
			</div>
		</div>
		<div class="ui-form-item">
			<label class="ui-label">
				<span class="ui-form-required">*</span>单用户限购
			</label>
			<input name="limit_num" class="ui-input_msg_num">
		</div>
		<div class="ui-form-item"><?=$saveBtn?></div>
	</fieldset>
</form>
</div>
</div>
</div>
</div><!--div.wrapper-->
<ul id="mainAreas"></ul>
<script>
//结束时间不得早于开始时间
$("#txtStartTime").bind("click focus", function () {             
   var endtimeTf = $dp.$('txtEndTime');             
   WdatePicker({                            
	   maxDate: '#F{$dp.$D(\'txtStartTime\')}',      
	   dateFmt: "yyyy-MM-dd HH:mm:ss",              
	   onpicked: function () { endtimeTf.focus(); }          
		});         
   });          
   $("#txtEndTime").bind("click focus", function () {       
		WdatePicker({           
		   minDate: '#F{$dp.$D(\'txtStartTime\')}', 
		   dateFmt: "yyyy-MM-dd HH:mm:ss"       
	   });         
   });
//选择隐藏
    $("#dropmsg_a").hide(); 
	$("#dropmsg").show(); 
	function change(){ 
		if($("#goods_style").attr("value")=='1'){ 
			$("#dropmsg_a").show(); 
			$("#dropmsg").hide(); 
		}else{ 
			$("#dropmsg_a").hide(); 
			$("#dropmsg").show(); 
		} 
	} 
</script>
<iframe src="about:blank" style="display: block;" id="hideFrame" name="hideFrame" frameborder="0"></iframe>
<script type="text/javascript" src="http://www.12301.cc/js/easydialog.min.js" ></script>
<script type="text/javascript" src="http://www.12301.cc/js/prod_pub.js"></script>
<script type="text/javascript" src="http://www.12301.cc/js/prod_editk_discount.js?body=1"></script>
<?include('../../common/footer.html')?>